package com.qf.ems.controller;

import com.qf.ems.entity.Emp;
import com.qf.ems.service.EmpService;
import com.qf.ems.service.impl.EmpServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/manager/safe/showEmp")
public class ShowEmpController extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //获取用户id
        String id = req.getParameter("id");
        //查询用户
        EmpService empService = new EmpServiceImpl();
        Emp emp = empService.selectEmpById(Integer.valueOf(id));
        //转发页面
        req.setAttribute("emp",emp);
        req.getRequestDispatcher("/updateEmp.jsp").forward(req,resp);
    }
}
